*****************************************************
****** Tiffany Barnes and Mirya Holman **************
****** Undergraduate Social Science Survey ******************
****** Set your working directory to save results produced in this file *****




//bring in data
use "USS.dta", clear


 
********************
********************
********************
*Generate Variables for Analyese 
gen woman= 1 if gender==2  //woman = 1; 0=otherwise
replace woman=0 if gender==1

recode lawschool (1=4) (2=3) (3=2) (4=1) //bigger values are more likly to go to law school 

*Create mean amgition scale normalize from 0 to 1. Larger values are more ambitious
egen ambition_mean = rowmean(ambition1 ambition2 ambition3  ) 
sum ambition_mean
gen ambition_mean_norm = (ambition_mean-r(min))/(r(max)-r(min))


*Create mean agentic trait scale normalize from 0 to 1. Larger values are more agentic
egen agentic_traits = rowmean(importance_traits_8 importance_traits_9 importance_traits_10 importance_traits_11 importance_traits_12 importance_traits_13  importance_traits_14 importance_traits_15 importance_traits_16 importance_traits_17 importance_traits_18 importance_traits_19 importance_traits_20 ) 
sum agentic_traits
gen agentic_traits_norm = (agentic_traits-r(min))/(r(max)-r(min))

alpha importance_traits_8 importance_traits_9 importance_traits_10 importance_traits_11 importance_traits_12 importance_traits_13  importance_traits_14 importance_traits_15 importance_traits_16 importance_traits_17 importance_traits_18 importance_traits_19 importance_traits_20, std item


*Create varaible for white respondents

gen white = 1 if strpos(race, "1")
replace white = 0 if strpos(race, "2")
replace white = 0 if strpos(race, "2,4")
replace white = 0 if strpos(race, "3")
replace white = 0 if strpos(race, "3,6")
replace white = 0 if strpos(race, "4")
replace white = 0 if strpos(race, "6")
replace white = 0 if strpos(race, "7")
replace white = 1 if strpos(race, "1")

*create conflict aversion variable 
egen conflict_aversion= rowmean(conflict_1 conflict_2 conflict_3 conflict_4)
alpha conflict_1 conflict_2 conflict_3 conflict_4, std item
sum conflict_aversion
gen conflict_aversion_norm = (conflict_aversion-r(min))/(r(max)-r(min))
sum conflict_aversion_norm

**** generate Figrue 3 **** 

gen yes_law = 1 if 	lawschool>=3
replace yes_law=0 if lawschool<3
egen mean_agentic_di = mean(agentic_traits_norm), by(yes_law)		

stripplot agentic_traits_norm, by(yes_law, compact note("")  row(1)) ///
jitter(4) box  iqr center stack h(0.5) ///
ytitle("Agentic Goals") mcolor(green) ///
xtitle(Interest in Law School) ///
vertical plotregion(lcolor(black) color(white))  name(G1, replace) 


**As noted in text: average level of agenticism is higher for individuals who say they plan to go to law school (0.64) than individuals who do not (0.60) 
ttest agentic_traits_norm, by(yes_law)
 

**** generate Table 1**** 

//lable variabless 
label variable lawschool "Plans to attend law school"
label variable agentic_traits_norm "Agentic Career Goals"
label variable children "Plans to have children"
label variable woman "Woman"
label variable  conflict_aversion_norm    "Conflict Aversion"

eststo clear
eststo: reg lawschool agentic_traits_norm  children  white woman
#delimit;
esttab using table1.rtf, se b(%9.3f) starlevels( * .10 ** .05 *** .01) r2(%9.2f) 
 title ("Table 1: Undergraduate Social Science Majors with Higher Agentic Goals Plan to Go to Law School")
 nogap
 label
 compress replace;
 #delimit cr

 
**** generate Figure 4****  
reg lawschool agentic_traits_norm  children  white woman conflict_aversion_norm

 margins , at(agentic_traits_norm=(0 	0.1562498	0.1874999	0.2187499	0.2499999	0.2812498	0.3124999	0.3437499	0.3749999	0.4062499	0.4374999	0.4687499	0.4999999	0.5312499	0.5624999	0.5937499	0.6249999	0.65625	0.6874999	0.7187499	0.7499999	0.78125	0.8124999	0.8437499	0.875	0.90625	0.9374999	0.96875	1))  level(84)


 
 marginsplot, title("") ///
	legend (rows(1) pos(6)) ///
    xtitle ("Agentic Traits", size(large)) ///
    ytitle (" ", size(large))  ///
    recast(line) recastci(rarea) ///
	ylabel (1 "No, definitely not" 2 "I might attend" 3 "Yes, considering It") /// 
	ci1opts(color(green%40)) ///
	plot1opts (lpattern("--") color(green))

	
**** Table A4: Correlations between items in the Agentic Scale, USS Sample ****
	
	
cor importance_traits_8 importance_traits_9 importance_traits_10 importance_traits_11 importance_traits_12 importance_traits_13  importance_traits_14 importance_traits_15 importance_traits_16 importance_traits_17 importance_traits_18 importance_traits_19 importance_traits_20 

**** Table A5: Agentic Career Goals: Principal-Component Factor Analysis ****

factor importance_traits_8 importance_traits_9 importance_traits_10 importance_traits_11 importance_traits_12  importance_traits_13 importance_traits_14 importance_traits_15 importance_traits_16 importance_traits_17 importance_traits_18 importance_traits_19 importance_traits_20,  pcf


**** Table A6: Agentic Career Goals Factor loadings (pattern matrix) and unique variances **** 
**** Table A7: Factor rotation matrix **** 

rotate, varimax horst blanks(.3) 

**** Table D1: Undergraduate Social Science Majors with Higher Agentic Goals Plan to Go to Law School (Complete results from Table 1 in manuscript) ****  

eststo clear
eststo: reg lawschool agentic_traits_norm
eststo: reg lawschool agentic_traits_norm  children  white woman
eststo: reg lawschool agentic_traits_norm  children  white woman conflict_aversion_norm


#delimit;
esttab using tableD1.rtf, se b(%9.3f) starlevels( * .10 ** .05 *** .01) r2(%9.2f) 
 title ("Agentic Traits Predict Interest in Law School")
 nogap
 label
 compress replace;
 #delimit cr
 

****  make three additional scales that we will use for robustness tests ****

egen influence_scale =  rowmean( importance_traits_11    importance_traits_14 importance_traits_15 importance_traits_16 importance_traits_17 importance_traits_18 importance_traits_19 ) 
sum influence_scale
gen influence_scale_norm = (influence_scale-r(min))/(r(max)-r(min))
//scale minus the minimum divided by range

egen prestige_scale = rowmean( importance_traits_9 importance_traits_10 importance_traits_11 importance_traits_12 importance_traits_16 importance_traits_20 ) 
sum prestige_scale
gen prestige_scale_norm =  (prestige_scale-r(min))/(r(max)-r(min))


egen financial_scale = rowmean(importance_traits_8   importance_traits_11  importance_traits_13   importance_traits_15 ) 
sum financial_scale
gen financial_scale_norm = (financial_scale-r(min))/(r(max)-r(min))

label variable prestige_scale_norm "Prestige Factor"
label variable influence_scale_norm "Influence Factor"
label variable financial_scale_norm "Wealth Factor"


****  Table D2: Influence Factor Predicting Interest in Law School **** 
eststo clear

eststo: reg lawschool influence_scale_norm 
eststo: reg lawschool influence_scale_norm   children  white woman
eststo: reg lawschool influence_scale_norm   children  white woman conflict_aversion_norm


#delimit;
esttab using tableD2.rtf, se b(%9.3f) starlevels( * .10 ** .05 *** .01) r2(%9.2f) 
 title ("Individualism Predicting Interest in Law School")
 nogap
 label
 compress replace;
 #delimit cr 


****  Table D3: Prestige Factor Predicting Interest in Law School **** 

eststo clear
eststo: reg lawschool prestige_scale_norm 
eststo: reg lawschool prestige_scale_norm   children  white woman
eststo: reg lawschool prestige_scale_norm   children  white woman conflict_aversion_norm


#delimit;
esttab using tableD3.rtf, se b(%9.3f) starlevels( * .10 ** .05 *** .01) r2(%9.2f) 
 title ("Accomplishment Predicting Interest in Law School")
 nogap
 label
 compress replace;
 #delimit cr 

****  Table D4: Wealth Factor Predicting Interest in Law School **** 

eststo clear
eststo: reg lawschool financial_scale_norm 
eststo: reg lawschool financial_scale_norm   children  white woman
eststo: reg lawschool financial_scale_norm   children  white woman conflict_aversion_norm


#delimit;
esttab using tableD4.rtf, se b(%9.3f) starlevels( * .10 ** .05 *** .01) r2(%9.2f) 
 title ("Financial Predicting Interest in Law School")
 nogap
 label
 compress replace;
 #delimit cr 


 **** Table D5: Comparing Goodness of Fit Predicting Interest in Law School ****
 

 eststo clear
eststo: reg lawschool agentic_traits_norm   
eststo: reg lawschool prestige_scale_norm 
eststo: reg lawschool agentic_traits_norm   children  white woman
eststo: reg lawschool prestige_scale_norm   children  white woman
eststo: reg lawschool agentic_traits_norm   children  white woman conflict_aversion_norm
eststo: reg lawschool prestige_scale_norm   children  white woman conflict_aversion_norm



#delimit;
esttab using tableD5.rtf, se b(%9.3f) starlevels( * .10 ** .05 *** .01) r2(%9.2f)   stats(r2 aic bic N)
 title ("Comparing Goodness of Fit Predicting Interest in Law School")
 nogap
 label
 compress replace;
 #delimit cr 
 
 
**** Table D6: Replicating Main USS Results with AJD Agenticism Measure  **** 

egen ajd_rep_scale = rowmean(importance_traits_9 importance_traits_12   importance_traits_13   ) 
sum ajd_rep_scale
gen ajd_rep_scale_norm = (ajd_rep_scale-r(min))/(r(max)-r(min))

alpha importance_traits_9 importance_traits_12   importance_traits_13
 
eststo clear
eststo: reg lawschool ajd_rep_scale_norm 
eststo: reg lawschool ajd_rep_scale_norm   children  white woman
eststo: reg lawschool ajd_rep_scale_norm   children  white woman conflict_aversion_norm


#delimit;
esttab using tableD6.rtf, se b(%9.3f) starlevels( * .10 ** .05 *** .01) r2(%9.2f) 
 title ("AJD Scale and Interest in Law School")
 nogap
 label
 compress replace;
 #delimit cr
 